feat(ui): raster cell + time axes; centralize viridis colormap#159
Merged
Conversation
The RasterOverview was a bare canvas heatmap with no axes and no intensity legend. Add a cell axis (left), a time axis (bottom, seconds when the sampling rate is known, else frame index), and a vertical viridis colorbar (right) with min/mid/max tick labels for the 1st/99th-percentile intensity range. The heatmap now renders into an inner plot rect with reserved margins; subset overlay boxes and click hit-testing are offset to match. Centralize the reusable pieces into @calab/ui/chart rather than leaving them CaDecon-local (CaDecon is one of several CaLab apps): - colormap.ts: VIRIDIS_LUT + viridisRGB/viridisCss — the standard scientific sequential colormap, now available to any app's heatmaps. - chart-math.ts: niceTicks() for 1/2/5×10^k axis ticks, with fp-residue rounding; unit-tested. The raster's warm subset-overlay palette stays local and intentionally distinct from the Okabe-Ito series palette — its job is contrast against viridis, not categorical distinctness. Verified: typecheck, eslint, prettier, 289 TS tests (incl. new niceTicks tests); browser shows labeled axes + colorbar with correctly-positioned subset boxes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review: the raster runs low→high activity on a standard viridis colormap and the absolute intensity values aren't meaningful, so the colorbar added clutter without information. Keep the cell and time axes; reclaim the right margin for the heatmap. VIRIDIS_LUT (shared) still backs the heatmap itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
drawAxes leaves ctx.textAlign='right'/textBaseline='middle'; drawSubsets drew the K-labels without resetting, so each label rendered right-aligned and vertically centered — landing outside its shaded background box. Reset to left/alphabetic before the label loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Raster Overview was a bare canvas heatmap — no axes. This adds:
The heatmap now renders into an inner plot rect with reserved left/bottom margins; the subset overlay boxes (K1..Kn) and click hit-testing are offset to match.
No intensity colorbar: viridis runs low→high activity, the absolute values aren't meaningful, and it's a standard enough colormap that a legend just adds clutter. (An earlier revision added one; removed per review.)
Centralization
Per the "CaDecon is one of several CaLab apps — centralize shared code" guideline, the reusable pieces move into
@calab/ui/chart:colormap.ts—VIRIDIS_LUT(+viridisRGB/viridisCsshelpers for future heatmaps). The viridis LUT was previously CaDecon-local; it still backs the raster heatmap and is now available to any app.chart-math.ts—niceTicks()(1/2/5×10^k axis ticks with fp-residue rounding), unit-tested.The raster's warm subset-overlay palette stays local and is intentionally not the Okabe-Ito series palette — its purpose is contrast against viridis (purple-teal-yellow), not categorical distinctness among series. Noted in-code.
Verification
niceTickstests).Follow-ups (deferred)
The axis-config/legend de-duplication across the uPlot charts (the audit found the
AXIS_*block copy-pasted 6+ times) remains for a later refactor PR.